home *** CD-ROM | disk | FTP | other *** search
/ MACD 5 / MACD 5.bin / workbench / tools / czesc_1 / easyprocess / source / launch / killprocs.c < prev    next >
C/C++ Source or Header  |  1992-09-07  |  1KB  |  59 lines

  1. #include <arpbase.h>
  2. #include <arp_proto.h>
  3. #include "Launch.h"
  4. #include "LaunchPriv.h"
  5.  
  6. /*
  7.  *    NAME
  8.  *        KillProcesses -- try to kill all child via a signal.
  9.  *
  10.  *    SYNOPSIS
  11.  *        KillProcesses ()
  12.  *
  13.  *        void KillProcesses (void);
  14.  *
  15.  *    DESCRIPTION
  16.  *        Send a KILL_PROCESS_FLAG signal to all child process of this
  17.  *        process.
  18.  *
  19.  *    INPUT
  20.  *        None.
  21.  *
  22.  *    OUTPUT
  23.  *        None.
  24.  *
  25.  *    NOTE
  26.  *        This only tries to kill your OWN child processes, not children
  27.  *        of your children.
  28.  *
  29.  *        This function does not wait to see if the processes really die,
  30.  *        you MUST call WaitProcesses() before quitting !!!
  31.  *
  32.  *    HISTORY
  33.  *        1992/09/06    Pierre Baillargeon        Creation
  34.  *
  35.  *    SEE ALSO
  36.  *        StartProcess(), WaitProcesses(), WaitProcess()
  37.  */
  38.  
  39. void KillProcesses (void)
  40. {
  41.     struct Process *Proc;
  42.     struct ProcPair *pp;
  43.  
  44.     Forbid ();
  45.     if (ProcPairList)
  46.     {
  47.         Proc = (struct Process *)FindTask (NULL);
  48.  
  49.         for (pp = (struct ProcPair *)ProcPairList->lh_Head; pp->pp_Node.ln_Succ; pp = (struct ProcPair *)pp->pp_Node.ln_Succ)
  50.         {
  51.             if (Proc == pp->pp_Parent)
  52.             {
  53.                 Signal (pp->pp_Child, KILL_PROCESS_FLAG);
  54.             }
  55.         }
  56.     }
  57.     Permit ();
  58. }
  59.